import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    loaded: false,
    loginState: false,
    loginResult: false,
    register: false,
    registerState: false,
    appSecret: "",
    wxApp: {
      // appId: "wx6b275740f9c67725",
      appId: "wx501434295a8a5f11",
      appSecret: "",
      scopeBase: "snsapi_base",
      scopeInfo: "snsapi_userinfo"
    },
    // apiOrigin: "http://ceodemo.hotkidclub.com:8290",
    apiOrigin: "http://ceoapi.hotkidclub.com:8280",
    apiPort: [
      "verityPhone:/ceo/b/goldencalf/checkMobile/",
      "verityPhoneInvited:/ceo/b/goldencalf/checkInvitationMobile/",
      "acceptVerityPhone:/ceo/b/goldencalf/checkInvitationMobile/",
      "verityCode:/ceo/b/goldencalf/checkMobileValidation/",
      "getCode:/ceo/b/goldencalf/sendValidationCode",
      "verityImgCode:/ceo/b/goldencalf/smsCode",
      "getImgCode:/ceo/b/goldencalf/captcha/code",
      "login:/ceo/b/goldencalf/add",
      "register:/ceo/b/goldencalf/addInvitation",
      "inviteList:/ceo/b/goldencalf/inviteList",
      "wxLogin:/ceo/b/goldencalf/userinfo?code=",
      "wxLoginInvite:/ceo/b/goldencalf/invitationUserinfo?code=",
      "wxSDK:/ceo/b/goldencalf/config",
      "inviter:/ceo/b/goldencalf/inviteSum/",
      "getLifeTime:/ceo/b/goldencalf/getTime"
    ],
    inviteId: "",
    cookieInviteId: "",
    invite: false,
    inviter: {},
    cuid: "",
    inviteList: [],
    wxInfo: null, //wenickName,headImageUrl,gender
    calfKey: null,
    calfKeyInvite: null,
    calfKeyCookie: null,
    appStore: {
      ios:
        "https://itunes.apple.com/cn/app/%E6%97%BA%E6%97%BA-%E6%97%BA%E4%BB%94%E6%97%BA%E9%93%BA/id1196191968?mt=8",
      android:
        "https://sj.qq.com/myapp/detail.htm?apkName=com.want.hotkidclub.ceo"
    },
    system: "ios",
    wxEnv: false,
    lifeInfo: ""
  },
  mutations: {
    upload(state, { prope, data }) {
      if (prope.split(".").length == 1) state[prope.split(".")[0]] = data;
      if (prope.split(".").length == 2)
        state[prope.split(".")[0]][prope.split(".")[1]] = data;
      if (prope.split(".").length == 3)
        state[prope.split(".")[0]][prope.split(".")[1]][
          prope.split(".")[2]
        ] = data;
      if (prope.split(".").length == 4)
        state[prope.split(".")[0]][prope.split(".")[1]][prope.split(".")[2]][
          prope.split(".")[3]
        ] = data;
      if (prope.split(".").length == 5)
        state[prope.split(".")[0]][prope.split(".")[1]][prope.split(".")[2]][
          prope.split(".")[3]
        ][prope.split(".")[4]] = data;
    }
  },
  actions: {}
});
